import json

from ronglian_sms_sdk import SmsSDK
#容联通信
accId = '8aaf0708732220a60173fb3cb5fc5c14'
accToken = '2367ba32954e4e25a1774380196ab245'
appId = '8aaf0708732220a60173fb3cb6e85c1b'


def send_message(phone, datas):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'  # 测试模板id为: 1. 内容为: 【云通讯】您的验证码是{1}，请于{2}分钟内正确输入。
    # mobile = '13303479527'
    # datas = ('666777', '5')  # 模板中的参数按照位置传递
    resp = sdk.sendMessage(tid, phone, datas)
    resp_dict = json.loads(resp)
    if resp_dict.get('statusCode') == '000000':
        return '0'
    return '-1'


# if __name__ == '__main__':
#     print(send_message('15660029292', ('1234', '5')))

